<template>
  <div class="store-add">
    <div class="header">
      <h1>店铺添加</h1>
      <p>添加店铺</p>
    </div>
    <div class="body">
      <a-form
        ref="ruleForm"
        style="width: 80%"
        :label-col="labelCol"
        :wrapper-col="wrapperCol"
        v-show="currentIndex == 0"
      >
        <a-form-item ref="name" label="店铺名" name="name">
          <a-input style="" />
        </a-form-item>
        <a-form-item ref="name" label="经营许可证" name="name">
          <a-input style="" />
        </a-form-item>
        <a-form-item ref="name" label="负责人姓名" name="name">
          <a-input style="" />
        </a-form-item>
        <a-form-item ref="name" label="负责人身份证号" name="name">
          <a-input style="" />
        </a-form-item>
        <a-form-item ref="name" label="负责人手机号" name="name">
          <a-input style="" />
        </a-form-item>
        <a-form-item ref="name" label="通知邮箱" name="name">
          <a-input style="" />
        </a-form-item>
      </a-form>
      <div v-show="currentIndex == 1">
        <a-result
          status="success"
          title="店铺添加成功"
          sub-title="已通过邮件的方式通知店主！"
        >
          <template #extra>
            <a-button
              key="console"
              type="primary"
              @click="goto('Store/StoreList')"
            >
              去店铺列表查看</a-button
            >
          </template>
        </a-result>
      </div>

      <div class="submit" v-show="currentIndex == 0">
        <a-button type="primary" @click="addOperation()">添加</a-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      labelCol: { span: 4 }, //表单标签宽度配置
      wrapperCol: { span: 14 }, //表单输入框宽度配置
      currentIndex: 0, //进行步骤 0 填写表单 1 成功页面
    };
  },
  methods: {
    //添加店铺操作
    addOperation() {
      //发请求
      this.currentIndex = 1;
    },
    //路由跳转
    goto(path) {
      this.currentIndex = 0;
      this.$router.push("/home/" + path);
    },
  },
};
</script>

<style lang="less" scoped>
.store-add .header {
  background-color: #fff;
  padding: 24px;
}
.store-add .header h1 {
  color: rgba(0, 0, 0, 0.85);
  font-weight: 600;
  font-size: 20px;
  line-height: 32px;
}
.store-add .body {
  padding: 24px;
  background-color: #fff;
  margin: 24px 16px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}
.submit {
  width: 40%;
  display: flex;
  justify-content: flex-end;
}
</style>